/*
 * GUICargaVHDL.java
 *
 * Created on 10 de mayo de 2010, 15:35
 */

package interfaz;

import javax.swing.JFrame;

/**
 * Interfaz gráfica para elegir si se carga un sólo fichero VHD o varios
 *
 * @author  David,Carlos y Tony
 */
public class GUICargaVHDL extends javax.swing.JDialog {

    /**
     * Tipo de selección que se hará. En este caso SeleccionCargaVHD
     */
    private Seleccion sel;
    

    /** Constructor del form GUICargaVHDL.
     * @param jf  Frame padre encargado de la llamada.
     * @param sel Tipo de Seleccion a elegir.
     * @param bol Indica si es modal o no.
     */
    public GUICargaVHDL(JFrame jf,boolean bol,Seleccion sel) {
        super(jf,bol);
        initComponents();
        this.sel=sel;
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        _btn_CargarTop = new javax.swing.JRadioButton();
        _btn_CargarVariosVHDL = new javax.swing.JRadioButton();
        _btnOK = new javax.swing.JButton();
        _btnCancelar = new javax.swing.JButton();

        setTitle("Cargar VHDL");
        setResizable(false);

        _btn_CargarTop.setSelected(true);
        _btn_CargarTop.setText("Cargar un VHDL ( Top)");
        buttonGroup1.add(_btn_CargarTop);
        _btn_CargarTop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _btn_CargarTopActionPerformed(evt);
            }
        });

        _btn_CargarVariosVHDL.setText("Cargar Varios VHDL y Seleccionar Top");
        buttonGroup1.add(_btn_CargarVariosVHDL);

        _btnOK.setText("OK");
        _btnOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _btnOKActionPerformed(evt);
            }
        });

        _btnCancelar.setText("Cancelar");
        _btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _btnCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(77, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(_btn_CargarTop)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(_btnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(_btnCancelar))
                        .addComponent(_btn_CargarVariosVHDL, javax.swing.GroupLayout.Alignment.LEADING)))
                .addGap(88, 88, 88))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {_btnCancelar, _btnOK});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(57, 57, 57)
                .addComponent(_btn_CargarTop)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(_btn_CargarVariosVHDL)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(_btnCancelar)
                    .addComponent(_btnOK))
                .addContainerGap(26, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {_btnCancelar, _btnOK});

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void _btn_CargarTopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__btn_CargarTopActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event__btn_CargarTopActionPerformed

private void _btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__btnOKActionPerformed
    
    if(_btn_CargarTop.isSelected())
    {
        sel.seleccion=SeleccionCargaVHD.SELECCION_VHDL_TOP;
    }
    else
    {
        if(_btn_CargarVariosVHDL.isSelected())
        {   
            sel.seleccion=SeleccionCargaVHD.SELECCION_VARIOS_VHDL;
        }
        else
            sel.seleccion=SeleccionCargaVHD.NADA;
    }
    this.dispose();
}//GEN-LAST:event__btnOKActionPerformed

private void _btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__btnCancelarActionPerformed
    this.setVisible(false);
}//GEN-LAST:event__btnCancelarActionPerformed

   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton _btnCancelar;
    private javax.swing.JButton _btnOK;
    private javax.swing.JRadioButton _btn_CargarTop;
    private javax.swing.JRadioButton _btn_CargarVariosVHDL;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables

}
